﻿// -----------------------------------------------------------------------
// <copyright file="CustomSplitContainer.cs" company="Abyssalsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Gui.ControlBuilders
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Xml;
    using System.Windows.Forms;
    using Metal.Resources;
    using Gui.ThemeEngine;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class CustomSplitContainer : BaseControl
    {
        /// <summary>
        /// Create the custom control
        /// </summary>
        /// <param name="controlProperties">The Xml node that contains the control properties</param>
        /// <returns>Returns custom control</returns>
        public Controls.MetalSplitContainer GetControl(XmlNode controlProperties)
        {
            Controls.MetalSplitContainer customSplitContainer = new Controls.MetalSplitContainer();

            // Apply common properties
            this.BuildControl(controlProperties, customSplitContainer as Control);

            if (PropertyProvider.GetValue(controlProperties, "Orientation", "Vertical") == "Vertical")
            {
                customSplitContainer.Orientation = Orientation.Vertical;
            }
            else
            {
                customSplitContainer.Orientation = Orientation.Horizontal;
            }

            //customSplitContainer.SplitterDistance = PropertyProvider.GetValue(controlProperties, "splitterDistance", 100);

            return customSplitContainer;
        }

        /// <summary>
        /// Apply common properties
        /// </summary>
        /// <param name="control">The Xml node that contains our control properties</param>
        /// <param name="customControl">The custom control that will be created</param>
        public override void BuildControl(System.Xml.XmlNode control, System.Windows.Forms.Control customControl)
        {
            base.BuildControl(control, customControl);
        }
    }
}
